import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        Set<Integer> set = toPrimeSet(n);
        for (int i = 1; i <= n/2; i++) {
            if (set.contains(i) && set.contains(n-i)) {
                arr[i] = n-i;
            }
        }
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] != 0) {
                map.put(Math.abs(arr[i]-i), i);
            }
        }
        for (int i = 0; i <= n/2; i++) {
            if (map.containsKey(i)) {
                System.out.println(map.get(i));
                System.out.println(n-map.get(i));
                break;
            }
        }
    }


    private static Set<Integer> toPrimeSet(int n) {
        Set<Integer> set = new HashSet<>();
        for (int i = 1; i <= n; i++) {
            if (isPrimeNumber(i)) {
                set.add(i);
            }
        }
        return set;
    }
    private static boolean isPrimeNumber(int num) {
        for (int i = 2; i < num; i++) {
            if (num % i == 0) {
                return false;
            }
        }
        return true;
    }
}
